Dockerfile Overview
The Duet Dockerfile uses a multi-stage build:- Build stage - Compiles the Go binary
- Run stage - Creates a minimal runtime environment with development tools
What’s Included
The Docker image includes:- Neovim - Text editor for collaborative coding
- Node.js & npm - JavaScript runtime and package manager
- OpenSSH - SSH server and key management
- Go binary - Compiled Duet server
Quick Start
1
Build the Docker image
2
Run the container
3
Connect via SSH
Configuration
Environment Variables
The Docker container accepts configuration through command-line arguments:Port Mapping
The Dockerfile exposes port2222 by default:
Volume Mounts
Persist workspaces across container restarts:Each room gets its own subdirectory under
/app/workspaces.Custom Worker URL
To use your own Cloudflare Worker:Docker Compose
Create adocker-compose.yml file:
Production Deployment
Fly.io
Duet includes afly.toml configuration for deployment on Fly.io:
1
Install Fly CLI
2
Login to Fly.io
3
Deploy the application
4
Set secrets
If you need to configure the Worker URL via secrets:
Resource Configuration
The default Fly.io configuration uses:- Memory: 1GB
- CPU: 1 shared CPU
- Auto-scaling: Machines stop when idle, start on demand
- Minimum running: 0 (cost-effective for low traffic)
The
auto_stop_machines and auto_start_machines settings help reduce costs by stopping idle machines.Security Considerations
SSH Host Keys
The Dockerfile generates SSH host keys at build time:Non-Root User
The container runs as a non-root userduet for security:
Troubleshooting
Check Container Logs
Interactive Shell
Access the container:Verify SSH Key
Check if the host key exists:Common Issues
- Connection refused: Verify port mapping is correct
- Permission denied: Check SSH host key permissions
- Worker not responding: Verify Worker URL is accessible from container